﻿using UnityEngine;
using System.Collections;

public class PlayerShootingBullet : MonoBehaviour 
{
	public float  m_Speed;
	public GameObject m_Bullet;//prefab "bullet"
	 
	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		ShootBullet();
	}
	void ShootBullet()
	{
		GameObject bulletShot;//instance
		Bullet cowBoyBullet; //un CowboyBullet de classe Bullet
		if(Input.GetButtonDown("Fire1"))
		{
			bulletShot = Instantiate(m_Bullet,transform.position, transform.rotation)as GameObject;
			cowBoyBullet = bulletShot.GetComponent<Bullet>();
			//cowBoyBullet.m_Speed = 10;
			cowBoyBullet.target = "Enemy";
			
		}	
		
	}
}
